]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
volume: Port to MetaSoundPlayer for emitting sounds
authorCarlos Garnacho <carlosg@gnome.org>
Thu, 13 Dec 2018 19:33:45 +0000 (20:33 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Wed, 9 Jan 2019 23:09:18 +0000 (23:09 +0000)
Move away from ShellGlobal API, which is too tightly coupled to
libcanberra-gtk.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/327

js/ui/status/volume.js

index 00af791a6ee4772744edaa41c8c98dc22e2bed1b..019030570d1a0cedbdf7f3bfcd75dbbaaad94f77 100644 (file)
@@ -57,6 +57,7 @@ var StreamSlider = new Lang.Class({
         });
 
         this._stream = null;
+        this._volumeCancellable = null;
     },
 
     get stream() {
@@ -129,11 +130,14 @@ var StreamSlider = new Lang.Class({
     },
 
     _notifyVolumeChange() {
-        global.cancel_theme_sound(VOLUME_NOTIFY_ID);
-        global.play_theme_sound(VOLUME_NOTIFY_ID,
-                                'audio-volume-change',
-                                _("Volume changed"),
-                                Clutter.get_current_event ());
+        if (this._volumeCancellable)
+            this._volumeCancellable.cancel();
+
+        this._volumeCancellable = new Gio.Cancellable();
+        let player = global.display.get_sound_player();
+        player.play_from_theme('audio-volume-change',
+                               _("Volume changed"),
+                               this._volumeCancellable);
     },
 
     _updateVolume() {